package com.tfj.widget;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hyphenate.tfj.R;


/**
 * Created by mac on 3/1/19.
 */

public class TitleBar extends RelativeLayout {
    private ImageButton  imagebtn_back;
    private TextView textView_title;
    public TitleBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        View view_bar = LayoutInflater.from(context).inflate(R.layout.title_bar,this);
        imagebtn_back=view_bar.findViewById(R.id.imagebtn_back);
        textView_title=view_bar.findViewById(R.id.textView_title);
        imagebtn_back.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ((Activity)context).finish();
            }
        });
    }
    public void setTitle(String title){
        textView_title.setText(title);
    }
}
